import { IParam } from '@core';
import { SysRoleServiceBase } from './sys-role-service-base';

/**
 * 系统角色服务
 *
 * @export
 * @class SysRoleService
 * @extends SysRoleServiceBase
 */
export class SysRoleService extends SysRoleServiceBase {

    /**
     * 基础数据服务实例
     * 
     * @private
     * @type { SysRoleService }
     * @memberof SysRoleService
     */
    private static basicDataServiceInstance: SysRoleService;

    /**
     * 数据服务存储Map对象
     *
     * @private
     * @type {Map<string, any>}
     * @memberof SysRoleService
     */
    private static dataServiceMap: Map<string, any> = new Map();

    /**
     * Creates an instance of SysRoleService.
     * @memberof SysRoleService
     */
    constructor(opts?: IParam) {
        super(opts);
    }

    /**
     * 获取实例
     *
     * @static
     * @param 应用上下文
     * @return {*}  { SysRoleService }
     * @memberof SysRoleService
     */
    static getInstance(opts?: IParam): SysRoleService {
        if (!this.basicDataServiceInstance) {
            this.basicDataServiceInstance = new SysRoleService(opts);
        }
        if (!opts || !opts.srfdynainstid) {
            return this.basicDataServiceInstance;
        } else {
            if (!SysRoleService.dataServiceMap.get(opts.srfdynainstid)) {
                SysRoleService.dataServiceMap.set(opts.srfdynainstid, new SysRoleService(opts));
            }
            return SysRoleService.dataServiceMap.get(opts.srfdynainstid);
        }
    }
}
export default SysRoleService;